package main;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.FileNotFoundException;

import javax.swing.JButton;
import javax.swing.JOptionPane;

import javazoom.jl.decoder.JavaLayerException;

public abstract class MediaButton extends JButton implements Mediafile, ActionListener {

	public abstract void play() throws FileNotFoundException, JavaLayerException;
	
	public void actionPerformed(ActionEvent e) {
		try {
			this.play();
		} catch (FileNotFoundException e1) {
			JOptionPane.showMessageDialog(this, e1.getLocalizedMessage());
		} catch (JavaLayerException e1) {
			JOptionPane.showMessageDialog(this, e1.getLocalizedMessage());
		}		
	}
}